
Component({
  /**
   * 组件的属性列表
   */
  properties: {
    boxWidth: {
      type: Number | String
    },
    sourceUrl: {
      type: String
    }, 
    url: {
      type: String
    },
    title: {
      type: String
    }
  },

  /**
   * 组件的初始数据
   */
  data: {
    imgurl: '',
    boxHeight: 0
  },
  observers: {
    'url': async function (urls) {
      // const result = await wx.getImageInfo({ src: urls });
      // const {  width, height } = result
      // this.setData({
      //   boxHeight: this.properties.boxWidth / width * height
      // })
      setTimeout(() => {
        this.setData({
          imgurl: urls
        })
      }, 500)
    }
  },

  /**
   * 组件的方法列表
   */
  methods: {
    async onTap(e) {
     this.triggerEvent('imgClick', this.properties.sourceUrl)
    },
  }
})
